import request from './request.js';
let service = request.service;
let formatterUrl = request.formatterUrl;
export default {
  getMyTaskManager(type, data) {
    return service({
      url: `/adscm/operation/taskManager/selectMyTaskManager/${type}`, //获取我的任务列表 0-待办交办任务，1-已办交办任务
      method: 'post',
      data
    })
  },
  assignmentList() {
    return service({
      url: `/adscm/operation/taskManager/selectTaskManager`, //获取下发交办任务列表
      method: 'get'
    })
  },
  /**创建每日任务*/
  insertEverDayTask() {
    return service({
      url: `/adscm/operation/taskManager/insertEverDayTask`,
      method: 'post'
    })
  },
  /**创建周总结*/
  insertWeekTask() {
    return service({
      url: `/adscm/operation/taskManager/insertWeekTask`,
      method: 'post'
    })
  },
  /***创建每日任务 */
  insertMonthTask() {
    return service({
      url: `/adscm/operation/taskManager/insertMonthTask`,
      method: 'post'
    })
  },
  /**新增-insert 修改-update 下发的任务 */
  insertUpdateIssuedTask(type, data) {
    return service({
      url: `/adscm/operation/taskManager/${type}`,
      method: 'post',
      data
    })
  },
  /**获取任务过程列表 */
  taskManagerdetail(id) {
    return service({
      url: `/adscm/operation/taskManagerdetail/selectByTid/${id}`,
      method: 'get'
    })
  },
  /**新增修改任务过程信息 */
  insertUpdateProcessDetail(type, data) {
    return service({
      url: `/adscm/operation/taskManagerdetail/${type}`, //type: insert-新增任务过程 update-修改任务过程
      method: 'post',
      data
    })
  },
  /**删除任务过程信息 */
  deleteTaskProcessDetail(id) {
    return service({
      url: `/adscm/operation/taskManagerdetail/delete/${id}`,
      method: 'get'
    })
  },
  /**获取下发任务说明列表 */
  getTaskInfoList(id) {
    return service({
      url: `/adscm/operation/taskManagerinfo/selectByTid/1/${id}`,
      method: 'get'
    })
  },
  /**新增-insert update-修改 1-任务说明 2-任务接收说明 */
  insertUpdateTaskInfo(data, type, taskType) {
    return service({
      url: `/adscm/operation/taskManagerinfo/${type}${taskType?('/'+taskType):''}`,
      method: 'post',
      data
    })
  },
  /**获取下发任务接收说明列表 */
  getTaskReceiveList(id) {
    return service({
      url: `/adscm/operation/taskManagerinfo/selectByTid/2/${id}`,
      method: 'get'
    })
  },

  /***删除下发的任务 */
  deleteTask1(id) {
    return service({
      url: `/adscm/operation/taskManager/delete/${id}`,
      method: 'get'
    })
  },
  /***删除任务 */
  deleteTask2(id) {
    return service({
      url: `/adscm/operation/taskManager/deleteDB/${id}`,
      method: 'get'
    })
  },
  /***获取附件列表 */
  getEnclosureList(id) {
    return service({
      url: `/adscm/operation/taskManagerAttchment/selectByFileId/${id}`,
      method: 'get'
    })
  },
  /**新增附件 附件上传*/
  insertEnclosure(data) {
    return service({
      url: `/adscm/operation/taskManagerAttchment/upload`,
      method: 'post',
      data
    }, 'upload')
  },
  /**删除附件 */
  deleteEnclosure(id) {
    return service({
      url: `/adscm/operation/taskManagerAttchment/delete/${id}`,
      method: 'get'
    })
  },
  /**下载附件 */
  downloadEnclosure(id) {
    return formatterUrl({
      url: `/adscm/operation/taskManagerAttchment/download/${id}`
    })
  },
  /**获取所有交办的任务列表 */
  allTaskManager(data) {
    return service({
      url: `/adscm/operation/taskManager/selectAllTaskManager`,
      method: 'post',
      data
    })
  },
  /**统计图获取用户数据 */
  getUserData(){
    return service({
      url: `/adscm/operation/taskManagerAnalysis/queryUser`,
      method: 'post'
    })
  },
  /**统计图 获取甘特图数据 */
  getGantData(user, start, end) {
    return service({
      url: `/adscm/operation/taskManagerAnalysis/queryTaskManager/${user}/${start}/${end}`,
      method: 'post'
    })
  },
   /**统计图 获取饼图数据 */
   getPieFinishData(user, start, end) {
     return service({
       url: `/adscm/operation/taskManagerAnalysis/querySelfWorthPieChart/${user}/${start}/${end}`,
       method: 'post'
     })
   },
   /**统计图 获取饼图数据 */
   getPieData(user, start, end) {
     return service({
       url: `/adscm/operation/taskManagerAnalysis/queryPieChartTime/${user}/${start}/${end}`,
       method: 'post'
     })
   }
}